package com.trg.flex
{
	import mx.rpc.IResponder;

	public class Responder implements IResponder
	{
		public function Responder(resultFunc:Function, faultFunc:Function = null, thisArg:* = null, extraData:* = null)
		{
			this.resultFunc = resultFunc;
			this.faultFunc = faultFunc;
			this.thisArg = thisArg;
			this.extraData = extraData;
		}
		
		public var resultFunc:Function;
		public var faultFunc:Function;
		public var thisArg:*;
		public var extraData:*;

		public function result(data:Object):void
		{
			if (resultFunc)
				FlexUtils.callFunc(resultFunc, thisArg, data, extraData);
		}
		
		public function fault(info:Object):void
		{
			if (faultFunc)
				FlexUtils.callFunc(faultFunc, thisArg, info, extraData);
		}
		
	}
}